package com.authine.cloudpivot.web.api.service.impl;

import com.authine.cloudpivot.web.api.dao.KHBZMapper;
import com.authine.cloudpivot.web.api.dao.XMKHBZMapper;
import com.authine.cloudpivot.web.api.domain.dto.AssessmentStandardDTO;
import com.authine.cloudpivot.web.api.domain.dto.ProjectAssessmentStandardDTO;
import com.authine.cloudpivot.web.api.service.AssessmentManagementService;
import com.authine.cloudpivot.web.api.service.ProjectAssessmentManagementService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.text.DecimalFormat;

@Slf4j
@Service
public class ProjectAssessmentManagementServiceImpl implements ProjectAssessmentManagementService {

    @Autowired
    private XMKHBZMapper xmkhbzMapper;

   /**
    * @Description : 根据评分查询对应比例，计算对应金额
    * @param ：
    * @author : Liun
    * @date : 2020/4/8
    */
   @Override
   public Double selectAmount(ProjectAssessmentStandardDTO dto){
       //根据条件查询出对应的比例
       int proportion=xmkhbzMapper.selectAmount(dto);
       int amount=proportion*dto.getBeforAmount();
       DecimalFormat df=new DecimalFormat("0.00");//设置保留位数
       return Double.valueOf(df.format((float)amount/100));
  }


}

